package com.yuelife.service.dao;
import com.yuelife.service.pojo.SProduct;
import com.yuelife.service.utils.ServiceProductDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/****
 * @Author:admin
 * @Description:SProduct的Dao
 * @Date 2019/6/14 0:12
 *****/
public interface SProductMapper extends Mapper<SProduct> {
    //查找前三名热门服务
    List<SProduct> selectSProduct();

    @Select("select * from s_product where storeId=#{storeId}")
    List<SProduct> selectSProductByStoreId(Integer storeId);

    @Select("select * from s_product where serviceId=#{serviceId}")
    SProduct selectSProductByserviceId(Integer serviceId);


    @Update("update s_product set status=0 where serviceId=#{serviceId}")
    void updateSProductStatusByserviceId(Integer serviceId);

    /**
     * 自定义条件查商品信息列表
     * @param pageNo
     * @param pageSize
     * @param serviceProductDTO
     * @return
     */
    List<SProduct> listServiceByCondition(@Param("page") Integer pageNo, @Param("limit") Integer pageSize, @Param("dto") ServiceProductDTO serviceProductDTO);

}
